package com.kaishengit.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.kaishengit.pojo.Goodsin;
import com.kaishengit.service.GoodsinService;

@Controller
public class GoodsinController {
	private GoodsinService goodsinService;
	
	
	@RequestMapping("/goodsinList")
	public String findAll(Model model){
		List<Goodsin> goodsinList = goodsinService.findAll();
		model.addAttribute("goodsinList", goodsinList);
		return "goodsinList";
	}
	@RequestMapping("goodsinlist")
	public String findByWhere(Model model,Goodsin goodsin){
		List<Goodsin> goodsinList = goodsinService.findByWhere(goodsin);
		model.addAttribute("goodsinList", goodsinList);
		return "goodsinList";
	}
	@RequestMapping("addGoodsin")
	public String addGoodsin(Goodsin goodsin){
		goodsinService.add(goodsin);
		return "redirect:/goodsin";
	}
	
	@Autowired
	public void setGoodsinService(GoodsinService goodsinService) {
		this.goodsinService = goodsinService;
	}
	
	

}
